﻿<?xml version="1.0" encoding="utf-8"?><Articles><Article><ArticlesID>548</ArticlesID><Title>Tạo ảnh từ 1 chuỗi c&amp;#243; sẵn</Title><Body>&amp;lt;p&amp;gt;C&amp;amp;aacute;i n&amp;amp;agrave;y rất tốt để tr&amp;amp;aacute;nh c&amp;amp;aacute;c &amp;lt;strong&amp;gt;Spider v&amp;amp;agrave;o lấy email&amp;lt;/strong&amp;gt; người d&amp;amp;ugrave;ng để đi spam &amp;lt;img alt=&amp;quot;&amp;quot; src=&amp;quot;http://dev.meotom.net/Library/Editor/fckeditor/editor/images/smiley/yahoo/4.gif&amp;quot; /&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;1. Tạo 1 file &amp;lt;strong&amp;gt;TextImage.ashx&amp;lt;/strong&amp;gt; trong Project&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;2. Copy đoạn code sau:&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: csharp;&amp;quot;&amp;gt;
using System;
using System.Web;
using System.Drawing;
using System.IO;

public class GenerateImage : IHttpHandler {
    public void ProcessRequest (HttpContext context) {
        string strDisplay = &amp;amp;quot;abc@abc.com&amp;amp;quot;;
        Bitmap bmpOut = new Bitmap(200, 50);
        Graphics g = Graphics.FromImage(bmpOut);
        g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
        g.FillRectangle(Brushes.Black,0,0,200,50);
        g.DrawString(strDisplay, new Font(&amp;amp;quot;Verdana&amp;amp;quot;, 18), new SolidBrush(Color.White), 0, 0);      
        MemoryStream ms = new MemoryStream();       
        bmpOut.Save(ms,System.Drawing.Imaging.ImageFormat.Png);
        byte[] bmpBytes = ms.GetBuffer();
        bmpOut.Dispose();
        ms.Close();
        context.Response.BinaryWrite(bmpBytes);
        context.Response.End();
    }

    public bool IsReusable {
        get {
            return false;
        }
    }
}&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;amp;nbsp;&amp;lt;/p&amp;gt;</Body><CommentEnabled>True</CommentEnabled><ViewCount>0</ViewCount><ReleaseDate>10/26/2009 2:36:30 AM</ReleaseDate><TotalComment>0</TotalComment><IsMedia>False</IsMedia><IsPicture>False</IsPicture><IsVote>True</IsVote><ArticlePassword /><PostVisible>0</PostVisible><ArticlePath>/2009/10/26/Tao-anh-tu-1-chuoi-c-243-san-224</ArticlePath><Approved>True</Approved><ImagePath /><CategoryId>26</CategoryId><ArrayCatID>26|25</ArrayCatID></Article></Articles>